package com.xiaodao.imports;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class MyFactoryBean  {

/*
implements FactoryBean, InvocationHandler
Class clazz;

	public MyFactoryBean(Class clazz) {
		this.clazz = clazz;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

		System.out.println("-----------------invoke");
		Method method1 = proxy.getClass().getInterfaces()[0].getMethod(method.getName(), String.class);
		Select annotation = method1.getDeclaredAnnotation(Select.class);
		System.out.println(annotation.value()[0]);
		return null;
	}
	// 将代理对象返回去
	@Override
	public Object getObject() throws Exception {
		//这里传入的就是接口.carddao
		Object o = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{clazz}, this);
		System.out.println(o.getClass());
		return o;
	}

	@Override
	public Class<?> getObjectType() {
		return clazz;
	}*/
}
